//
//  HZJDownLoadViewController.m
//  HZ_Beautiful_Music
//
//  Created by dllo on 16/4/7.
//  Copyright © 2016年 ui. All rights reserved.
//

#import "HZJDownLoadViewController.h"
//#import "ASIHTTPRequest.h"
#import "HZJDownLOadTVCell.h"

@interface HZJDownLoadViewController ()<NSURLConnectionDataDelegate, UITableViewDelegate, UITableViewDataSource>

@property (nonatomic, strong) UITableView *tableView;

//
//@property (nonatomic, strong) NSFileHandle *writeHandle;
//
//@property (nonatomic, assign) long totalLength;
//
//@property (nonatomic, assign) long currentLength;
///**
// *  连接对象
// */
//@property (nonatomic, strong) NSURLConnection *connection;

@end


@implementation HZJDownLoadViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    
    [self creatTable];
    
    self.navigationItem.title = @"下载列表";
    
}

- (void)creatTable {
    
    self.tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    
    [_tableView registerClass:[HZJDownLOadTVCell class] forCellReuseIdentifier:@"HZJDownLOadTVCell"];
    
    [self.view addSubview:_tableView];
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 70;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return _data.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    HZJDownLOadTVCell *cell = [tableView dequeueReusableCellWithIdentifier:@"HZJDownLOadTVCell"];
//    cell.delegate = self;
    NSIndexPath *num = _data[indexPath.row];
    cell.detailModel = self.dataSource[num.row];
    cell.listModel = self.dataSource[num.row];
    
    return cell;
}

- (void)setData:(NSMutableArray *)data {
    _data = data;
    [_tableView reloadData];
}

- (void)setDataSource:(NSMutableArray *)dataSource {
    
    _dataSource = dataSource;
    [_tableView reloadData];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
